/**
 * @version   $Id: cpanel.js 57 2011-02-18 10:33:30Z happy_noodle_boy $
 * @package   JCE
 * @copyright Copyright (C) 2009 Ryan Demmer. All rights reserved.
 * @license   GNU/GPL
 * This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */
(function($) {
    $.jce.CPanel = {
        init : function(options) {
    		$('ul.newsfeed').addClass('loading').html('<li>' + options.feed + '</li>');

            // Get feed
            $.getJSON("index.php?option=com_jce&view=cpanel&task=feed", {}, function(r) {
                $('ul.newsfeed').removeClass('loading').empty();

                $.each(r.feeds, function(k, n) {
                    $('ul.newsfeed').append('<li><a href="' + n.link + '" title="' + n.title + '">' + n.title + '</a></li>');
                });

            });

            // Check updates
            $.getJSON("index.php?option=com_jce&view=updates&task=update&step=check", {}, function(r) {
                if (r.length) {
                    var item = ('<li><span>' + options.updates + '</span><span class="updates"><a title="' + options.updates + '" class="dialog modal updates" rel="{\'width\' : 760, \'height\' : 540}" href="index.php?option=com_jce&amp;view=updates&amp;tmpl=component">' + options.updates_available + '</a></span></li>');

                    $.jce.createDialog($('div#jce ul.adminformlist').append(item).find('a.dialog.updates'));
                }
            });

        }

    }
})(jQuery);